<?php
class actDzcl extends logCAr
{
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}
	
	/* reset db */
	public function getDbConnection()
	{
		self::$db=Yii::app()->db1;
		if(self::$db instanceof CDbConnection) return self::$db;
	}
	
    public function tableName()
	{
		return '{{act_dzcl}}';
	}
    /* rules */
    public function rules()
    {
        return array(
            array('title,game_id,type', 'safe', 'on'=>'search'),
        );
    }

    public function relations()
    {
        // class name for the relations automatically generated below.
        return array(
            'game' => array(self::BELONGS_TO, 'actGames', 'game_id'),

        );
    }


    public function search()
    {
        $criteria=new CDbCriteria;
        $criteria->order='create_time desc';
        $criteria->compare('del_flag',0);
        $criteria->compare('title',$this->title);
        $criteria->compare('game_id',$this->game_id);
        $criteria->compare('type',$this->type);
        return new CActiveDataProvider($this, array(
            'criteria'=>$criteria,
        ));
    }

    public function allType(){
        return [
            "1"=>"海报",
            "2"=>"视频",
            "3"=>"易拉宝",
            "4"=>"图片",
        ];
    }



}